<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <table border="1">
    <caption>个人信息</caption>
    <tr>
      <td>照片:</td><td><img :src="person.url"></td>
    </tr>
    <tr><td>姓名:</td><td>{{person.name}}</td></tr>
    <tr><td>年龄:</td><td>{{person.age}}</td></tr>
    <tr>
      <td>好友:</td>
      <td>
        <ul>
          <li v-for="name in person.friends">{{name}}</li>
        </ul>
      </td>
    </tr>
  </table>
  <input type="button" value="加载数据" @click="f()">
</div>
<script src="js/vue.js"></script>
<script>
  Vue.createApp({
    data() {
      return {
        person:{name:"",age:"",url:"",friends: []}
      }
    },
    methods: {
      f() {
        //假设下面的对象是从服务器请求回来的数据
        this.person = {name:"传奇哥",age:18,url:"../b.jpg",
          friends:["孙尚香","虞姬","武则天"]}
      }
    },
  }).mount("body>div");
</script>
</body>
</html>